#include "solver.h"
#include "grid.h"

Solver::Solver()
{
	m_grid = new Grid();
}

Solver::~Solver()
{
	delete m_grid;
}

int Solver::runSolvingRound()
{
	int deleted_candidates_count = 0;
	int promoted_values_count = 0;

	deleted_candidates_count += m_grid->deleteCandidatesByValue();
	promoted_values_count += m_grid->promoteSingleCandidates();

	return deleted_candidates_count + promoted_values_count;
}

bool Solver::runUnitTest()
{
	Solver* p_solver = new Solver();

	// runSolvingRound should return 0, 
	// because grid has initially no values, 
	// so no progress can be made.
	if (p_solver->runSolvingRound() != 0)
		return false;

	return true;
}